import React from 'react';
import type { ICacheRducerAction } from './cacheReducer';

export interface ICacheContext {
  mount: (params: { cacheId: string; element: React.ReactNode }) => void;
  cacheStates: Record<string, any>;
  dispatch: (dispatchParams: ICacheRducerAction) => void;
  handleScroll: (cacheId: string, event: React.WheelEvent) => void;
  activeCache: (cacheId: string) => void;
  cacheWatch: (cacheIds: string[], fn: any) => void;
  removeCacheWatch: (cacheIds: string[], fn: any) => void;
}

const CacheContext = React.createContext<ICacheContext>({
  mount: () => {},
  cacheStates: {},
  dispatch: () => {},
  handleScroll: () => {},
  activeCache: () => {},
  cacheWatch: () => {},
  removeCacheWatch: () => {},
});
export default CacheContext;
